<style>
		label, input.text { display:block; }
		input.text { margin-bottom:12px; width:95%; padding: .4em; }
		fieldset { padding:0; border:0; margin-top:25px; }
		
</style>
<p>Please <a id='signin' href="#">Sign in</a> or <a id="registr" href="#">Register</a></p>
<div id='signin' title="Войти" > 
       <form id="form_signin" action="{{ path('_security_check') }}" method="POST">
           <fieldset>
               <label for="username">Логин:</label>
               <input type="text" id="username" name="_username" class="text ui-widget-content ui-corner-all" value="{{ last_username }}" />
               <label for="password">Пароль:</label>
               <input type="password" id="password" class="text ui-widget-content ui-corner-all" name="_password" />
           </fieldset>
    </form>
</div>
<div id="registr" title="Новый пользователь">
    <form id="form_registr" action="{{ path('_registr_form') }}" method="POST" id="contact_form">
        {{ form_errors(form) }}
        {{ form_row(form.username) }}
        {{ form_row(form.email) }}
        {{ form_row(form.password) }}
        {% block captcha_widget %} {%endblock%}
        {{ form_rest(form) }}
        <br/>
        <input type="radio" name="user_type" value="client" checked="checked"> Вы обычный пользоватль</br>
        <input type="radio" name="user_type" value="firm"> Вы фирма        
    </form>
</div>
{% block post_init_javascript %}
<script type="text/javascript">
    $(function(){
        $( "div#signin" ).dialog({
			autoOpen: false,
			height: 300,
			width: 350,
			modal: true,
			buttons: {
				"Sign in": function() {
                                   $( this ).dialog( "close" );
                                   $('#form_signin').submit();
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			}
		});
        $('a#signin').click(function(){
            $( "div#signin" ).dialog( "open" );
        });
        
        $( "div#registr" ).dialog({
			autoOpen: false,
			height: 400,
			width: 350,
			modal: true,
			buttons: {
				"Registr": function() {
                                  $( this ).dialog( "close" );
                                  $('#form_registr').submit();
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			}
		});
        $('a#registr').click(function(){
           $('div#registr').dialog( "open" );
        });
    });
    
</script>
{% endblock %}